package com.hanserwei.han_picture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hanserwei.han_picture.domain.entity.po.Space;
import com.hanserwei.han_picture.domain.entity.po.User;
import com.hanserwei.han_picture.domain.entity.vo.SpaceVO;
import com.hanserwei.han_picture.domain.request.space.SpaceAddRequest;
import com.hanserwei.han_picture.domain.request.space.SpaceEditRequest;
import com.hanserwei.han_picture.domain.request.space.SpaceQueryRequest;
import com.hanserwei.han_picture.domain.request.space.SpaceUpdateRequest;

public interface SpaceService extends IService<Space> {

    Page<Space> listSpaceByPage(SpaceQueryRequest request);

    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage);

    SpaceVO getSpaceVO(Space space);

    void checkSpaceAuth(User loginUser, Space space);

    SpaceVO spaceToSpaceVO(Space space);

    Space spaceVOtoSpace(SpaceVO spaceVO);

    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest queryRequest);

    boolean deleteSpace(Long id, User loginUser);

    void validSpace(Space space, boolean add);

    long addSpace(SpaceAddRequest request, User loginUser);

    boolean updateSpace(SpaceUpdateRequest request);

    boolean editSpace(SpaceEditRequest editRequest, User loginUser);

    /**
     * 验证空间配额是否足够
     *
     * @param spaceId         空间ID
     * @param additionalCount 要添加的图片数量
     * @param additionalSize  要添加的图片总大小
     * @return 是否有足够配额
     */
    boolean checkSpaceQuota(Long spaceId, long additionalCount, long additionalSize);

    /**
     * 获取空间剩余配额信息
     *
     * @param spaceId 空间ID
     * @return 包含剩余配额的数组 [剩余数量, 剩余大小]
     */
    long[] getSpaceRemainingQuota(Long spaceId);
}
